package com.sitech.ibnms.util.charts.am;

public class AmChartCommon {
	/**
	 * ��ȡdiv��ͼ���ʽ����
	 * 
	 * @param div_id
	 * @return
	 */
	public static String getScript(AmChartParameter parameter) {

		/*
		 * <script type="text/javascript" src="amline/swfobject.js"></script>
		 * <div id="flashcontent"> <strong>You need to upgrade your Flash Player</strong>
		 * </div> <script type="text/javascript"> var so = new
		 * SWFObject("amline/amline.swf", "amline", "30%", "40%", "8",
		 * "#FFFFFF"); so.addVariable("path", "amline/");
		 * so.addVariable("settings_file",
		 * encodeURIComponent("amline/amline_settings.xml"));
		 * so.addVariable("data_file",
		 * encodeURIComponent("amline/amline_data.xml"));
		 * so.write("flashcontent"); </script>
		 */

		String chartScript = "<div id=\"" + parameter.getAmDiv_id() + "\">\n";
		chartScript += "<strong>You need to upgrade your Flash Player</strong>\n";
		chartScript += "</div>\n";
		chartScript += "<script type=\"text/javascript\">\n";
		chartScript += "var so = new SWFObject(\"" + parameter.getAmChartPath()
				+ "\", \"" + parameter.getAmChartId() + "\", \""
				+ parameter.getAmChartWidth() + "\", \""
				+ parameter.getAmChartHeight() + "\", \"8\", \""
				+ parameter.getAmBgColour() + "\");\n";
		chartScript += "so.addVariable(\"path\", \"amCharts/amline/\");\n";
		chartScript += "so.addVariable(\"chart_settings\", encodeURIComponent(\"#amline_settings#\"));\n";
		chartScript += "so.addVariable(\"chart_data\", encodeURIComponent(\"#amline_data#\"));\n";
		chartScript += "so.write(\"" + parameter.getAmDiv_id() + "\");\n";
		chartScript += "</script>";
		return chartScript;
	}
}
